<?php
$menuLarge = ($filter_name == 'categories') ?>
<div class="FB_ActionMenu ml1 bloc_filter_<?php echo ($count < 2) ? 'left' : 'right';
                                                echo  $menuLarge ? ' FB_ActionMenuLarge' : '' ?>">
  <?php if (!count($filter['items'])): ?>
    <?php echo link_to_function(__($filter['title']).' <i class="icon chevron_blue"></i>', 'fssTrack(\''.urlencode($filter['title']).'\');', array('class' => 'FB_button FB_buttonDisabled', 'id' => 'filter_'.$filter_name)) ?>
  <?php else: ?>
    <?php echo link_to_function(__($filter['title']).' <i class="icon chevron_blue"></i>', 'fssTrack(\''.urlencode($filter['title']).'\');', array('class' => 'FB_button', 'id' => 'filter_'.$filter_name)) ?>
  <?php endif ?>
  <div class="FB_ActionContainer">
    <div class="FB_ActionMenu_Menu">
      <div <?php if ($sf_params->has('embedded') && $sf_params->get('embedded')) { echo 'style="max-height:410px;overflow:auto;height:410px !zonecss"'; } ?> class="FB_SelectList <?php if ($menuLarge === true) { echo 'FB_SelectList_Menu_bloc'; } ?>">
        <?php $index = 0 ?>
        <?php foreach ($filter['items'] as $data_key => $item): ?>
          <?php $index++ ?>
          <?php if ($menuLarge === true): ?>
            <div class="FB_SelectList_MenuWrapper mr1">
              <a href="#" class="FB_SelectList_Menu <?php echo $item['checked'] ? 'FB_SelectList_check_Checked' : '' ?>" id="<?php echo $filter_name.$data_key ?>" onclick="fssTrack('<?php echo urlencode($item['label']) ?>'); return false;" onmouseup="fss.stopEvent();" data-key="<?php echo $data_key ?>">
                  <span class="text"><?php echo $item['label'] ?>&nbsp;<span class="text-black">(<?php echo $item['count'] ?>)</span>
                  </span>
                  <span class="jewelCount" id="jewelCount<?php echo $filter_name.$data_key ?>">
                    <span class="jewelCount_inner">1</span>
                  </span>
              </a>
            </div>
            <?php if($index%2 == 0): ?>
              <div class="clb"></div>
            <?php endif ?>
          <?php else: ?>
             <div class="FB_SelectList_Item">
               <label for="filter_<?php echo $filter_name ?>">
                 <input type="checkbox" name="filter_<?php echo $filter_name ?>[]" id="filter_<?php echo $filter_name.$item['index'] ?>" value="<?php echo $data_key ?>" class="inputcheckbox" <?php echo $item['checked'] ? 'checked="checked"' : '' ?>/>
                 <span <?php if ($sf_params->has('embedded') && $sf_params->get('embedded')) { echo 'style="padding-right:22px;"'; } ?> class="FB_SelectList_Label <?php echo $item['checked'] ? 'FB_SelectList_check_Checked' : '' ?>"  id="<?php echo $filter_name.$item['index'] ?>" onclick="fssTrack('<?php echo urlencode($item['label']) ?>'); return false" onmouseup="fss.stopEvent()">
                 <span class="filter_name"><?php echo $filter_name == 'country' ? format_country($item['label']) : $item['label'] ?></span>&nbsp;<span class="filter_count text-black">(<?php echo $item['count'] ?>)</span>
                </span>
              </label>
            </div>
            <div class="clb"></div>
          <?php endif ?>
        <?php endforeach ?>
        <div class="clb"></div>
      </div><!-- . FB_SelectList -->

      <?php if (isset($filter['sub_items'])):  ?>
      <?php foreach ($filter['sub_items'] as $data_key => $sub_items): ?>
      <div class="FB_SelectList FB_SelectList_subfunctions" id="<?php echo 'sub_'.$filter_name.$data_key ?>">
        <h3 class="grey ma0 clb"><?php echo __('Choose sub-categories') ?></h3>
        <?php $index2 = 0; ?>
        <?php foreach ($sub_items as $key => $item): ?>
        <?php $index2++ ?>
        <div class="FB_SelectList_subfunctions_bloc">
          <div class="FB_SelectList_Item mr1" title="<?php echo $item['label'] ?>">
            <label for="filter_<?php echo $filter_name ?>">
              <input type="checkbox" name="filter_sub_<?php echo $filter_name ?>[]" id="filter_sub_<?php echo $filter_name.$key ?>" value="<?php echo $key ?>" class="inputcheckbox <?php echo $filter_name ?>">
              <span class="FB_SelectList_Label " id="<?php echo $filter_name.$key ?>" data-parent="<?php echo $filter_name.$data_key ?>">
                <?php echo $item['label'] ?>&nbsp;<span class="text-black">(<?php echo $item['count'] ?>)</span>
            </span>
            </label>
          </div>
        </div>
        <?php if($index2%2 == 0): ?>
          <div class="clb"></div>
        <?php endif ?>
        <?php endforeach ?>

        <div class="clb"></div>
      </div><?php // .FB_SelectList ?>
      <?php endforeach ?>

      <?php endif ?>

      <div class="FB_SelectList noDeco">
          <?php if ($menuLarge === true): ?>
          <div class="FB_SelectList_close pa05">
             <a href="#" title="<?php echo __("Ok") ?>" onclick="$.vtnsFilters('submit'); return false" class="vtns_buttonBlue mr05 fright">
                <?php echo __('Ok') ?>
             </a>
             <div class="clb"></div>
          </div>
          <?php else: ?>
          <div class="littleClose">
              <a href="#" title="<?php echo __("close") ?>" onclick="$.vtnsFilters('closeAll'); return false">
                  <span class="fright FB_icons icon_delete"></span>
              </a>
          </div>
          <?php endif ?>
        <div class="clb"></div>
      </div>

    </div><!-- .FB_ActionMenu_Menu -->
  </div><!-- .FB_ActionContainer -->
</div>
